const { contextBridge, ipcRenderer } = require('electron');

// 使用 contextBridge 安全地暴露 ipcRenderer API
contextBridge.exposeInMainWorld('electron', {
  send: (channel, data) => ipcRenderer.send(channel, data),
  receive: (channel, func) => ipcRenderer.on(channel, (event, ...args) => func(...args)),
  invoke: (channel, data)=> ipcRenderer.invoke(channel, data)
});